package com.tiantian.subject.domain.entity;

import com.tiantian.common.core.constraints.level.CheckLevel;
import com.tiantian.common.core.domain.model.BaseEntity;
import com.tiantian.common.core.validate.AddGroup;
import com.tiantian.common.core.validate.EditGroup;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;

/**
 * @author tiantian
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Subject extends BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = -48118181694057959L;

    /**
     * 题目ID
     */
    @NotBlank(message = "题目ID不能为空", groups = {EditGroup.class})
    private String topicId;

    /**
     * 出题人Id(userId)
     */
    private Long authorId;

    /**
     * 出题人真实姓名
     */
    private String authorName;

    /**
     * 题目标题
     */
    @NotBlank(message = "题目标题不能为空", groups = {AddGroup.class, EditGroup.class})
    private String title;

    /**
     * 题目难度(0简单 1中等 2困难)
     */
    @CheckLevel
    private String level;

    /**
     * 序号
     */
    @NotNull(message = "序号不能为空")
    private Integer order;

    /**
     * 总分
     */
    @NotNull(message = "题目分值不能为空")
    private Integer totalPoints;

    /**
     * 题目详细信息
     */
    @NotBlank(message = "题目详细信息不能为空", groups = {AddGroup.class, EditGroup.class})
    private String detail;

    /**
     * 代码模板
     */
    private String codeTemplate;

    /**
     * 题目状态(0待审核 1审核未通过 2审核通过)
     */
    private String status;

    /**
     * 删除标记(0未删除 1已删除)
     */
    private String delFlag;

    /**
     * 题目标签(数据库中不存在的字段)
     */
    private List<String> tags;
}

